package com.hotai.controller;
import com.hotai.comment.dtos.ResponseResult;
import com.hotai.service.AccountService;
import com.hotai.service.CoursewareService;
import com.hotai.vo.account.AccountPage;
import com.hotai.vo.account.AccountTeach;
import com.hotai.vo.account.AccountUrl;
import com.hotai.vo.account.WechatMsgwm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;


@RequestMapping("/account")
@RestController
public class AccountsController {
    @Autowired
    private CoursewareService coursewareService;

    @Autowired
    private AccountService accountService;

    @RequestMapping("/find")
    private ResponseResult findAll(AccountPage accountPage){
        return coursewareService.Accountfind(accountPage);
    }

    //评测报告
    @RequestMapping("/findWeek")
    private ResponseResult findWeek(AccountPage accountPage){
        return coursewareService.findWeek(accountPage);
    }
    //周期周报
    @RequestMapping("/Weekperiod")
    private ResponseResult Weekperiod(AccountPage accountPage){
        return coursewareService.WeekPeriod(accountPage);
    }




    //教学周报
    @RequestMapping("/Teachperiod")
    private ResponseResult teach(AccountTeach accountPage){
        return coursewareService.TearPeriod(accountPage);
    }

    //实验时长
    @RequestMapping("/TeachCount")
    private ResponseResult teachshi(AccountTeach accountPage){
        return coursewareService.TeachCount(accountPage);
    }

    //学科统计
    @RequestMapping("/SbujectCount")
    private ResponseResult Subjectshi(AccountTeach accountPage){
        return coursewareService.Subjectshi(accountPage);
    }


    //微信JS-SDK 权限

    @RequestMapping("/Jssdkconfig")
    private ResponseResult Jssdkconfig(@RequestBody AccountUrl accountUrl){
        return accountService.Jssdkconfig(accountUrl);
    }
    //获取用户信息
    @RequestMapping("/Jssdkcode")
    private ResponseResult Jssdkcode(@RequestParam String  code,@RequestParam Integer id ){
        return accountService.Jssdkconde(code,id);
    }

    //集成模板消息推送  课程
    @RequestMapping("/Msg")
    @Scheduled(cron = "0 40 19 * * ?")
    public ResponseResult msgChat(  ) {
//        String poid="ozI2Z6Inqi0wnJYXizR-XsJGovdQ";
        return     accountService.SendWe();
    }

    //集成模板消息推送  报告
    @RequestMapping("/SendWechat")
    @Scheduled(cron = "0 30 19 ? * FRI")
    public ResponseResult msgChatWech() {
//        String poid="ozI2Z6Inqi0wnJYXizR-XsJGovdQ";
//        System.out.println(2);
        return     accountService.msgChatWecha();
    }

}
